#include <54func.h>
//目标：主线程与子线程同时对全局变量（数据段）进行自增10000
int global = 0;
void *threadFunc(void *arg)
{
    for(int i = 0;i<10000;i++)
    {
        ++global;
    }
    printf("child add finshed!\n");
}
int main()
{
    pthread_t tid;
    int ret = pthread_create(&tid,NULL,threadFunc,NULL);
    THREAD_ERROR_CHECK(ret,"pthread_create");
    for(int i = 0;i<10000;i++)
    {
        ++global;
    }
    printf("man add finished!\n");
    sleep(1);
    printf("global = %d\n",global);
    return 0;
}
